import router from './router/index'
// import store from './store/index'
router.beforeEach((to, from, next) => {
  // console.log(to)
  // console.log(to.path)
  // console.log(from)
  if (to.path === '/login') {
    return next()
  }
  if (to.path === '/register') {
    return next()
  }
  // const token = store.state.user.token
  const token = localStorage.getItem('token')
  if (!token) {
    return next('/login')
  }
  next()
})
